package org.nuonuo.sdk.model.callback.content;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.nuonuo.sdk.constant.InvoiceConstant;
import org.nuonuo.sdk.model.base.Additional;
import org.nuonuo.sdk.model.base.InvoiceItem;
import org.nuonuo.sdk.model.base.SecondHandCar;
import org.nuonuo.sdk.model.base.Vehicle;

import java.util.List;

/**
 * @Version 1.0
 * @Author az
 * @Date 2024-04-11 11:21:04
 * @ClassName IssueContent
 * @Description 开票回调信息
 */
public class IssueContent {

    /**
     * 发票流水号
     */
    @JsonProperty("c_fpqqlsh")
    private String serialNo;

    /**
     * 订单号
     */
    @JsonProperty("c_orderno")
    private String orderNo;

    /**
     * <pre>
     * 发票状态：
     *  1：开票完成;
     *  2：开票失败;
     *  3：开票成功签章失败（电票时）；
     * 注：
     *  1、企业资质-开票失败是否回调 为是” 时返回该字段；
     *  2、（开票失败、开票成功签章失败时 ） content中只返回：发票流水号、发票状态、销方税号、失败原因 四个字段；
     * </pre>
     */
    @JsonProperty("c_status")
    private String status;
    /**
     * 发票状态描述
     */
    private String statusMsg;

    @JsonProperty("c_digitAccount")
    private String digitAccount;

    /**
     * 开票日期
     */
    @JsonProperty("c_kprq")
    private Long invoiceDate;
    /**
     * 发票代码（全电电票时为空，全电纸票时有值）
     */
    @JsonProperty("c_fpdm")
    private String invoiceCode;
    /**
     * 发票号码（全电电票时为空，全电纸票时有值） allElectronicInvoiceNumber  Sting N 22312000000000183317  全电发票号码（全电发票（电票+纸票）时有值）  20
     */
    @JsonProperty("c_fphm")
    private String invoiceNo;

    /**
     * 红票对应的蓝票发票代码（蓝票为全电电票时为空，全电纸票时有值）
     */
    @JsonProperty("c_yfpdm")
    private String oldInvoiceCode;
    /**
     * 红票对应的蓝票发票号码（蓝票为全电电票时为空，全电纸票时有值）
     */
    @JsonProperty("c_yfphm")
    private String oldInvoiceNo;
    /**
     * 红票对应的蓝票的全电发票号码（蓝票为全电发票（电票+纸票）时返回） </bre>
     * exg: 22312000000000183316
     */
    private String oldEleInvoiceNumber;
    /**
     * 价税税额（保留小数点后2位）
     */
    @JsonProperty("c_hjse")
    private String taxAmount;
    /**
     * 不含税金额（保留小数点后2位）
     */
    @JsonProperty("c_bhsje")
    private String exTaxAmount;
    /**
     * 客户端不在线  失败原因（只有发票状态c_status 为 2 或 3 时返回）
     */
    @JsonProperty("c_errorMessage")
    private String failCause;
    /**
     * 发票pdf地址（若同时返回了ofdUrl与pdfUrl，则pdf文件不能做为原始凭证，请用ofd文件做为原始凭证） </bre>
     * 示例：https://inv.jss.com.cn/group1/M00/A6/4C/wKgHPll_IU-AVELfAACNq5bmzFM769.pdf
     */
    @JsonProperty("c_url")
    private String pdfUrl;
    @JsonProperty("c_cjsj")
    private String cjsj;
    /**
     * 发票详情地址 </bre>
     * 示例：nnfp.jss.com.cn/h6Oj0Dn?p=Kh4Nj
     */
    @JsonProperty("c_jpg_url")
    private String pictureUrl;
    /**
     * 购方邮箱
     */
    @JsonProperty("email")
    private String notifyEmail;
    /**
     * 购方手机，以下字段需经诺诺配置才可返回
     */
    private String phone;

    /**
     * 购方税号
     */
    @JsonProperty("taxnum")
    private String payerTaxNo;
    /**
     * 购方名称
     */
    @JsonProperty("buyername")
    private String payerName;
    /**
     * 购方电话
     */
    private String telephone;
    /**
     * 购方地址
     */
    private String address;
    /**
     * 购方银行开户行及账号<br/>
     * 示例：杭州农业银行13766103980009876
     */
    private String bankAccount;
    /**
     * 价税合计/含税金额（保留小数点后2位）
     */
    @JsonProperty("c_hjje")
    private String orderAmount;
    /**
     * 校验码
     */
    private String checkCode;
    /**
     * 二维码
     */
    private String qrCode;
    /**
     * 税控设备号（机器编号）
     */
    private String machineCode;
    /**
     * 发票密文
     */
    private String cipherText;
    private String naturalPersonFlag;
    /**
     * <pre>
     *   发票种类:
     *     p:普通发票(电子);
     *     c:普通发票(纸质);
     *     b:专用发票(电子);
     *     s:专用发票(纸质);
     *     e:收购发票(电子);
     *     f:收购发票(纸质);
     *     r:普通发票(卷式);
     *     j:机动车销售统一发票
     *     u:二手车销售统一发票;
     *     bs:电子发票(增值税专用发票),
     *     pc:电子发票(普通发票)
     *     es:全电纸质发票(增值税专用发票),
     *     ec:全电纸质发票(普通发票)
     * </pre>
     */
    @JsonProperty("c_invoice_line")
    private String invoiceKind;

    /**
     * 开票员
     */
    @JsonProperty("c_clerk")
    private String clerk;
    /**
     * 收款人
     */
    @JsonProperty("c_payee")
    private String payee;
    /**
     * 复核人
     */
    @JsonProperty("c_checker")
    private String checker;
    /**
     * 销方银行账号
     */
    @JsonProperty("c_salerAccount")
    private String salerAccount;
    /**
     * 销方税号
     */
    @JsonProperty("c_saletaxnum")
    private String salerTaxNum;
    /**
     * 销方名称
     */
    @JsonProperty("c_salerName")
    private String salerName;
    /**
     * 销方电话
     */
    @JsonProperty("c_salerTel")
    private String salerTel;
    /**
     * 销方地址
     */
    @JsonProperty("c_salerAddress")
    private String salerAddress;
    /**
     * 备注
     */
    @JsonProperty("c_remark")
    private String remark;

    /**
     * <pre>
     * 成品油标志:
     *  0:非成品油;
     *  1:成品油;
     * </pre>
     */
    private String productOilFlag;
    /**
     * <pre>
     * 清单标志：
     *  0：非清单；
     *  1：清单；
     * </pre>
     */
    @JsonProperty("c_qdbz")
    private String listFlag;

    /**
     * 清单项目名称
     */
    @JsonProperty("c_qdxmmc")
    private String listName;
    /**
     * 分机号
     */
    private String extensionNumber;
    /**
     * 终端号
     */
    private String terminalNumber;
    /**
     * 发票jpg图片地址（清单票发票主信息与清单信息以”,”隔开）
     */
    @JsonProperty("c_imgUrls")
    private String imgUrls;
    /**
     * 纸票pdf地址（含底图）
     */
    @JsonProperty("c_paper_pdf_url")
    private String paperPdfUrl;
    /**
     * 发票ofd地址
     */
    @JsonProperty("c_ofd_url")
    private String ofdUrl;
    /**
     * 开票员id
     */
    @JsonProperty("c_clerkId")
    private String clerkId;
    /**
     * <pre>
     * 机动车专票标志:
     *  0:非机动车;
     *  1:机动车;
     * </pre>
     */
    private String vehicleFlag;
    /**
     * <pre>
     * 冲红原因：
     *  1:销货退回;
     *  2:开票有误;
     *  3:服务中止;
     *  4:发生销售折让(开具红票时且票种为p,c,e,f,r 可能会返回--成品油发票均不会返回)
     * </pre>
     */
    private String redReason;
    /**
     * <pre>
     * 发票特定要素：（后续枚举值会有扩展，回传其他信息时返回）
     *  0-普通
     *  1-成品油发票
     *  3-建筑服务
     *  4-货物运输服务
     *  6-不动产经营租赁服务
     *  9-旅客运输服务
     *  31-建安发票
     *  32-房地产销售发票
     *  33-二手车发票反向开具
     *  34-电子烟
     *  35-矿产品
     * </pre>
     */
    private String specificFactor;

    /**
     * 购买方经办人姓名（全电发票时返回）
     */
    private String buyerManagerName;
    /**
     * 经办人证件类型（全电发票时返回）
     */
    private String managerCardType;
    /**
     * 经办人身份证件号码（全电发票时返回）</bre>
     * exg: 330105200001011100
     */
    private String managerCardNo;
    /**
     * 自定义模版 附加模版名称（全电发票时返回）
     */
    private String additionalElementName;

    /**
     * 部门id
     */
    @JsonProperty("c_deptId")
    private String deptId;

    @JsonProperty("dt_invoicedate")
    private Long invoiceTime;
    @JsonProperty("c_gxsj")
    private String gxsj;

    /**
     * 全电发票号码（全电发票
     */
    private String allElectronicInvoiceNumber;

    /**
     * 二手车销
     */
    private SecondHandCar secondHandCarInfo;

    /**
     * 附加要素信息列表（全电电票时返回）
     */
    private List<Additional> additionalElementList;

    /**
     * 机动车销售统一发票中机动车相关信息（只有票种j 机动车销售统一发票才会返回）
     */
    private List<Vehicle> vehicleInfo;

    /**
     * 发票明细信息
     */
    private List<InvoiceItem> invoiceItems;

    public String getSerialNo() {
        return serialNo;
    }

    public void setSerialNo(String serialNo) {
        this.serialNo = serialNo;
    }

    public String getOrderNo() {
        return orderNo;
    }

    public void setOrderNo(String orderNo) {
        this.orderNo = orderNo;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
        switch (status) {
            case "1":
                this.statusMsg = "开票完成";
                break;
            case "2":
                this.statusMsg = "开票失败";
                break;
            case "3":
                this.statusMsg = "开票成功签章失败";
                break;
        }
    }

    public String getStatusMsg() {
        return statusMsg;
    }

    public Long getInvoiceDate() {
        return invoiceDate;
    }

    public void setInvoiceDate(Long invoiceDate) {
        this.invoiceDate = invoiceDate;
    }

    public String getInvoiceCode() {
        return invoiceCode;
    }

    public void setInvoiceCode(String invoiceCode) {
        this.invoiceCode = invoiceCode;
    }

    public String getInvoiceNo() {
        return invoiceNo;
    }

    public void setInvoiceNo(String invoiceNo) {
        this.invoiceNo = invoiceNo;
    }

    public String getOldInvoiceCode() {
        return oldInvoiceCode;
    }

    public void setOldInvoiceCode(String oldInvoiceCode) {
        this.oldInvoiceCode = oldInvoiceCode;
    }

    public String getOldInvoiceNo() {
        return oldInvoiceNo;
    }

    public void setOldInvoiceNo(String oldInvoiceNo) {
        this.oldInvoiceNo = oldInvoiceNo;
    }

    public String getOldEleInvoiceNumber() {
        return oldEleInvoiceNumber;
    }

    public void setOldEleInvoiceNumber(String oldEleInvoiceNumber) {
        this.oldEleInvoiceNumber = oldEleInvoiceNumber;
    }

    public String getTaxAmount() {
        return taxAmount;
    }

    public void setTaxAmount(String taxAmount) {
        this.taxAmount = taxAmount;
    }

    public String getExTaxAmount() {
        return exTaxAmount;
    }

    public void setExTaxAmount(String exTaxAmount) {
        this.exTaxAmount = exTaxAmount;
    }

    public String getFailCause() {
        return failCause;
    }

    public void setFailCause(String failCause) {
        this.failCause = failCause;
    }

    public String getPdfUrl() {
        return pdfUrl;
    }

    public void setPdfUrl(String pdfUrl) {
        this.pdfUrl = pdfUrl;
    }

    public String getCjsj() {
        return cjsj;
    }

    public void setCjsj(String cjsj) {
        this.cjsj = cjsj;
    }

    public String getPictureUrl() {
        return pictureUrl;
    }

    public void setPictureUrl(String pictureUrl) {
        this.pictureUrl = pictureUrl;
    }

    public String getNotifyEmail() {
        return notifyEmail;
    }

    public void setNotifyEmail(String notifyEmail) {
        this.notifyEmail = notifyEmail;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getPayerTaxNo() {
        return payerTaxNo;
    }

    public void setPayerTaxNo(String payerTaxNo) {
        this.payerTaxNo = payerTaxNo;
    }

    public String getPayerName() {
        return payerName;
    }

    public void setPayerName(String payerName) {
        this.payerName = payerName;
    }

    public String getTelephone() {
        return telephone;
    }

    public void setTelephone(String telephone) {
        this.telephone = telephone;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getBankAccount() {
        return bankAccount;
    }

    public void setBankAccount(String bankAccount) {
        this.bankAccount = bankAccount;
    }

    public String getOrderAmount() {
        return orderAmount;
    }

    public void setOrderAmount(String orderAmount) {
        this.orderAmount = orderAmount;
    }

    public String getCheckCode() {
        return checkCode;
    }

    public void setCheckCode(String checkCode) {
        this.checkCode = checkCode;
    }

    public String getQrCode() {
        return qrCode;
    }

    public void setQrCode(String qrCode) {
        this.qrCode = qrCode;
    }

    public String getMachineCode() {
        return machineCode;
    }

    public void setMachineCode(String machineCode) {
        this.machineCode = machineCode;
    }

    public String getCipherText() {
        return cipherText;
    }

    public void setCipherText(String cipherText) {
        this.cipherText = cipherText;
    }

    public String getNaturalPersonFlag() {
        return naturalPersonFlag;
    }

    public void setNaturalPersonFlag(String naturalPersonFlag) {
        this.naturalPersonFlag = naturalPersonFlag;
    }

    public String getInvoiceKind() {
        return invoiceKind;
    }

    public void setInvoiceKind(String invoiceKind) {
        this.invoiceKind = invoiceKind;
    }

    public String getClerk() {
        return clerk;
    }

    public void setClerk(String clerk) {
        this.clerk = clerk;
    }

    public String getPayee() {
        return payee;
    }

    public void setPayee(String payee) {
        this.payee = payee;
    }

    public String getChecker() {
        return checker;
    }

    public void setChecker(String checker) {
        this.checker = checker;
    }

    public String getSalerAccount() {
        return salerAccount;
    }

    public void setSalerAccount(String salerAccount) {
        this.salerAccount = salerAccount;
    }

    public String getSalerTaxNum() {
        return salerTaxNum;
    }

    public void setSalerTaxNum(String salerTaxNum) {
        this.salerTaxNum = salerTaxNum;
    }

    public String getSalerName() {
        return salerName;
    }

    public void setSalerName(String salerName) {
        this.salerName = salerName;
    }

    public String getSalerTel() {
        return salerTel;
    }

    public void setSalerTel(String salerTel) {
        this.salerTel = salerTel;
    }

    public String getSalerAddress() {
        return salerAddress;
    }

    public void setSalerAddress(String salerAddress) {
        this.salerAddress = salerAddress;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public String getProductOilFlag() {
        return productOilFlag;
    }

    public void setProductOilFlag(String productOilFlag) {
        this.productOilFlag = productOilFlag;
    }

    public String getListFlag() {
        return listFlag;
    }

    public void setListFlag(String listFlag) {
        this.listFlag = listFlag;
    }

    public String getListName() {
        return listName;
    }

    public void setListName(String listName) {
        this.listName = listName;
    }

    public String getExtensionNumber() {
        return extensionNumber;
    }

    public void setExtensionNumber(String extensionNumber) {
        this.extensionNumber = extensionNumber;
    }

    public String getTerminalNumber() {
        return terminalNumber;
    }

    public void setTerminalNumber(String terminalNumber) {
        this.terminalNumber = terminalNumber;
    }

    public String getImgUrls() {
        return imgUrls;
    }

    public void setImgUrls(String imgUrls) {
        this.imgUrls = imgUrls;
    }

    public String getPaperPdfUrl() {
        return paperPdfUrl;
    }

    public void setPaperPdfUrl(String paperPdfUrl) {
        this.paperPdfUrl = paperPdfUrl;
    }

    public String getOfdUrl() {
        return ofdUrl;
    }

    public void setOfdUrl(String ofdUrl) {
        this.ofdUrl = ofdUrl;
    }

    public String getClerkId() {
        return clerkId;
    }

    public void setClerkId(String clerkId) {
        this.clerkId = clerkId;
    }

    public String getVehicleFlag() {
        return vehicleFlag;
    }

    public void setVehicleFlag(String vehicleFlag) {
        this.vehicleFlag = vehicleFlag;
    }

    public String getRedReason() {
        return redReason;
    }

    public void setRedReason(String redReason) {
        this.redReason = redReason;
    }

    public String getSpecificFactor() {
        return specificFactor;
    }

    public void setSpecificFactor(String specificFactor) {
        this.specificFactor = specificFactor;
    }

    public String getBuyerManagerName() {
        return buyerManagerName;
    }

    public void setBuyerManagerName(String buyerManagerName) {
        this.buyerManagerName = buyerManagerName;
    }

    public String getManagerCardType() {
        return managerCardType;
    }

    public void setManagerCardType(String managerCardType) {
        this.managerCardType = managerCardType;
    }

    public String getManagerCardNo() {
        return managerCardNo;
    }

    public void setManagerCardNo(String managerCardNo) {
        this.managerCardNo = managerCardNo;
    }

    public String getAdditionalElementName() {
        return additionalElementName;
    }

    public void setAdditionalElementName(String additionalElementName) {
        this.additionalElementName = additionalElementName;
    }

    public String getDeptId() {
        return deptId;
    }

    public void setDeptId(String deptId) {
        this.deptId = deptId;
    }

    public Long getInvoiceTime() {
        return invoiceTime;
    }

    public void setInvoiceTime(Long invoiceTime) {
        this.invoiceTime = invoiceTime;
    }

    public String getGxsj() {
        return gxsj;
    }

    public void setGxsj(String gxsj) {
        this.gxsj = gxsj;
    }

    public String getAllElectronicInvoiceNumber() {
        return allElectronicInvoiceNumber;
    }

    public void setAllElectronicInvoiceNumber(String allElectronicInvoiceNumber) {
        this.allElectronicInvoiceNumber = allElectronicInvoiceNumber;
    }

    public SecondHandCar getSecondHandCarInfo() {
        return secondHandCarInfo;
    }

    public void setSecondHandCarInfo(SecondHandCar secondHandCarInfo) {
        this.secondHandCarInfo = secondHandCarInfo;
    }

    public List<Additional> getAdditionalElementList() {
        return additionalElementList;
    }

    public void setAdditionalElementList(List<Additional> additionalElementList) {
        this.additionalElementList = additionalElementList;
    }

    public List<Vehicle> getVehicleInfo() {
        return vehicleInfo;
    }

    public void setVehicleInfo(List<Vehicle> vehicleInfo) {
        this.vehicleInfo = vehicleInfo;
    }

    public List<InvoiceItem> getInvoiceItems() {
        return invoiceItems;
    }

    public void setInvoiceItems(List<InvoiceItem> invoiceItems) {
        this.invoiceItems = invoiceItems;
    }

    public void setStatusMsg(String statusMsg) {
        this.statusMsg = statusMsg;
    }

    public String getDigitAccount() {
        return digitAccount;
    }

    public void setDigitAccount(String digitAccount) {
        this.digitAccount = digitAccount;
    }

    /**
     * 获取业务系统发票状态
     * @return
     */
    @JsonIgnore
    public InvoiceConstant.InvoiceStatus getInvoiceStatus() {
        return InvoiceConstant.callbackInvoiceStatusParse(status);
    }
}
